
<form class="layui-form seller-form" action="" method="post">
    <div class="layui-form-item">
        <div class="layui-inline">
            <input type="text" name="username" lay-verify="title" style="width:200px;"
                 class="layui-input" placeholder="Username">
        </div>
        <div class="layui-inline">
            <input type="text" name="secret_key" lay-verify="title" style="width:200px;"
                   class="layui-input" placeholder="secret_key">
        </div>
        <div class="layui-inline" style="">
            <select name="user_type" lay-verify="" >
                <option value="">please select User Type</option>
                <option value="0">Single</option>
                <option value="1">Share</option>
            </select>
        </div>
        <div class="layui-inline" style="padding-left:20px;">
            <button class="layui-btn layui-btn-sm" lay-submit lay-filter="user-search"><i
                    class="iconfont icon-chaxun"></i>Search</button>
        </div>
    </div>
</form>

<div class="table-body">
    <table id="userTable" lay-filter="test"></table>
</div>
<script>
    layui.use(['form', 'table' , 'laydate'], function () {

//        //时间插件
//        layui.laydate.render({
//            elem: '#datetime',
//            range: '_',
//            format: 'yyyy-MM-dd'
//        });

        var tableIn = layui.table.render({
            elem: '#userTable',
            height: 'full-139',
            cellMinWidth: '80',
            url: "{:url('userKey')}?_ajax=1",
            id: 'userTable',
            cols: [[
                { type: 'numbers'},
                { field: 'username', align: 'left', style:'font-weight:bold;' ,width:200, title: 'User Name'},
                { field: 'user_type', title: 'UserType', width:150 ,
                    templet: function (d) {
                        const user_type = d.user_type;
                        if(user_type == 1){
                            return '<font color="red">Share</font>';
                        }else{
                            return 'Single';
                        }
                    }
                },
                { field: 'secret_key', title: 'Secret Key', align:"right",width:300,
                    style:'color:#FF5722;font-weight:bold'},
                { field: 'base64_json_key', title: 'base64_json_key', align:"right",
                    style:'color:#FF5722;font-weight:bold'}

            ]],
            page: true,
            limit: 20,
            limits: [20, 50, 100],
        });
        //搜索
        layui.form.on('submit(user-search)', function (data) {
            layui.table.reload('userTable', {
                where: data.field
                , page: {
                    curr: 1 //重新从第 1 页开始
                },
                method:'POST'
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });

    });
</script>